#include "chaog.h"

unsigned int s,t;

sbit rx=P1^0;
sbit tx=P1^1;

void main_chaog()
{
		unsigned char num=10;
		rx=0;
		TL1 = 0xF4;		//??????
		TH1 = 0xFF;		//??????
		TF1 = 0;		//??TF1??
		TR1 = 1;		//???1????
		while(num--)
		{
			while(!TF1);
			rx^=1;
			TF1=0;
		}
		TR1=0;
		TL1 = 0x00;		//??????
		TH1 = 0x00;		//??????
		TF1 = 0;		//??TF1??
		TR1 = 1;		//???1????
		while(tx&&!TF1);
		TR1=0;
		if(TF1)
		{
			s=255;
			TF1=0;
		}else 
		{
			t=(TH1<<8)|TL1;
			s=(unsigned int)(t/58.3);
			
		}
}